//
//  FourView.m
//  Ting
//
//  Created by 安静的美男子 on 14/11/21.
//  Copyright (c) 2014年 安静的美男子. All rights reserved.
//

#import "FourView.h"
#import "UIButton+WebCache.h"

@implementation FourView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        _view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 150, 170)];
        _view .layer.borderWidth = 1;
        _view.layer.borderColor = [[UIColor lightGrayColor]CGColor];
        [self addSubview:_view];
        
        
        _button = [UIButton buttonWithType:UIButtonTypeCustom];
        _button.frame = CGRectMake(5, 5, 140, 140);
        [_view addSubview:_button];
        
        _title = [[UILabel alloc]initWithFrame:CGRectMake(5, 150, 140, 20)];
        _title.textAlignment = NSTextAlignmentCenter;
        _title.font = [UIFont systemFontOfSize:15];
        [_view addSubview:_title];
        
    }
    return self;
    
}

-(void)setViewWithArr:(NSMutableArray *)Arr num:(NSInteger)num
{
    [_button sd_setBackgroundImageWithURL:[NSURL URLWithString:[Arr[num] objectForKey:@"albumCoverUrl290"]] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"123.gif"]];
    _title.text = [Arr[num] objectForKey:@"title"];
    
}
@end
